package com.alibaba.nacos.config.server.jpa.aspect;

import java.util.Arrays;
import java.util.Objects;

/**
 * The type of nacos-all.
 *
 * @author 问道于盲
 * @date 2020-03-10
 */
public class MethodInfo {
    private String methodName;

    private Class[] argTypes;

    public MethodInfo(String methodName, Class[] argTypes) {
        this.methodName = methodName;
        this.argTypes = argTypes;
    }

    /**
     * get methodName
     *
     * @return methodName
     */
    public String getMethodName() {
        return methodName;
    }

    /**
     * set methodName
     *
     * @param methodName methodName
     */
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    /**
     * get argTypes
     *
     * @return argTypes
     */
    public Class[] getArgTypes() {
        return argTypes;
    }

    /**
     * set argTypes
     *
     * @param argTypes argTypes
     */
    public void setArgTypes(Class[] argTypes) {
        this.argTypes = argTypes;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MethodInfo that = (MethodInfo) o;
        return Objects.equals(methodName, that.methodName) &&
            Arrays.equals(argTypes, that.argTypes);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(methodName);
        result = 31 * result + Arrays.hashCode(argTypes);
        return result;
    }
}
